<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/25
 * Time: 0:25
 */
class GoodsAttribute_model extends CI_Model{
    const TBL_CATE = "goods_attribute";

    //根据指定的商品类型id查询出所属的所有商品属性
    public function attribute_list($goods_type){
        $query = $this->db->where(array('type_id'=>$goods_type))->get(self::TBL_CATE);
        return $query->result_array();
    }

    //根据指定的商品类型id查询出所属的所有商品属性
    public function attribute_num($goods_type){
        return $this->db->where(array('type_id'=>$goods_type))->count_all_results(self::TBL_CATE); // Produces an integer, like 17
    }
}